<?php


namespace App\Model;


/**
 * App\Model\GoodsMode
 *
 * @property int $id
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property int $goods_id 商品id
 * @property string $mode 模型参数，json格式
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\GoodsMode newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\GoodsMode newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\GoodsMode query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\GoodsMode whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\GoodsMode whereGoodsId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\GoodsMode whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\GoodsMode whereMode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\GoodsMode whereUpdatedAt($value)
 * @mixin \Eloquent
 */
class GoodsMode extends Base
{

    protected $table='goods_mode';

    protected $fillable=['goods_id','mode'];


    function getModeAttribute($value)
    {
        if(!$value) return $this->attributes['mode']=[];

        return $this->attributes['mode']=json_decode($value,true);

    }




}
